<template>
  <div class="TreeView">
    <div class="content_header">
      <route-location :additional="selectRow ? selectRow.name: ''"></route-location>
    </div>
    <div class="content_warp">
      {{ dataSource }}
    </div>
  </div>
</template>

<script>
import { httpRequest } from "@/untils/httpRequest";
import RouteLocation from "@/components/RouteLocation";

export default {
  name: "TreeView",
  props: {
    selectRow: {
      type: Object,
      default() {
        return {};
      }
    }
  },
  components: { RouteLocation },
  data() {
    return {
      dataSource: []
    };
  },
  methods: {
    getList(group_id) {
      let params = {
        group_id: group_id
      };
      httpRequest("GET", "/getGroupById", params, null).then((res) => {
        this.dataSource = res.data.data.list;
      });
    }
  },
  watch: {
    selectRow: {
      immediate: true, deep: true,
      handler(value) {
        if (value && value.id) {
          this.getList();
        }
      }
    }
  },
  mounted() {
  }
};
</script>

<style scoped lang="less">
.TreeView {
  width: 100%;
  height: 100%;
  overflow: auto;

  .content_header {
    width: 100%;
    height: 46px;
  }

  .content_warp {
    width: 100%;
    height: calc(100% - 46px);
    padding: 16px;
    overflow: auto;
  }
}
</style>